<?php

namespace co2\dev\v0_0_0\bash;

use co2\dev\v0_0_0 as co2;

class chown extends co2\bash

{
	public function
	__construct
	(
		$file,
		$user,
		\stdClass $options=null
	)
	{
		$this->cmd='chown ';
		
		if(is_object($options))
		foreach(array('r','R','recursive') as $_)
		if(isset($options->$_) && is_bool($options->$_) && $options->$_)
		$this->cmd.='-R ';
		
		$this->cmd.=$user;
		
		if(is_object($options))
		if(isset($options->group) && is_string($options->group))
		$this->cmd.=':'.$options->group;
		
		$this->cmd.=' '.$file;
		
		$this->exec();
	}
}
